 <div id="Intacct_DialogParent"></div>
<p id="Intacct_StatusField"></p>

<script type="text/javascript">
    var bootstrapScript = "https://s3.amazonaws.com/global.intacctservices.com/Fixed+Assets/intacct_bootstrap_fa.js";
    var pageName = "ViewAPBill";

    function intacctInitAdditionalParams() {
        return null; 
    }

    // Retrieve configuration settings
    var intacctIntacctConfig = {
        apiAccessKey : "{!CURRENTCOMPANY.TITLE!}",
        sessionID : "{!#CURR_SESSION!}",
        entityID : "{!CURRENTENTITY#id!}",
        userID : "{!CURRENTUSER.id!}",
        userLogin : "{!CURRENTUSER.login!}",
        userEmail : "{!CURRENTUSER.email!}",
        baseCurrency : window.BASECURRENCY,
        jq : jq
    }

    function intacctInitValidationSettings() {
        var validationSettings = {};
        // NOTE Make sure the View ID corresponds to the All Fixed Assets Settings view
        {!#LOOP_BEGIN.all#115800@10252!}
        Intacct.Intacct.storeFixedAssetsValidationSetting(validationSettings, 
                        "{!fixed_assets_setting.section_name!}", 
                        "{!fixed_assets_setting.parameter_name!}",
                        "{!fixed_assets_setting.value!}");
        {!#LOOP_END.all!}
        
        // Also possible to store settings globally for all validation -- those settings should take precedence
        {!#LOOP_BEGIN.all#129818@10308!}
        Intacct.Intacct.storeGlobalValidationSetting(validationSettings, "{!validation_setting.parameter_name!}", "{!validation_setting.value!}");
        {!#LOOP_END.all!}
        return validationSettings;
    }

    // -------------------
    // -------------------
    jq(function() {
        try {
            jq.ajax({
                url: bootstrapScript,
                dataType: "script",
                cache : true
            })
            .done(function(script, textStatus) {
                Intacct_Bootstrap.initPage({
                    page : pageName,
                    statusField : jq("#Intacct_StatusField"),
                    dialogParent : jq("#Intacct_DialogParent"),
                    getIntacctConfig : function(){return intacctIntacctConfig;},
                    getValidationSettings : intacctInitValidationSettings,
                    getAdditionalParams : intacctInitAdditionalParams
                });
            })
            .fail(function(jqxhr, settings, exception) {
                console.error("Failed to load bootstrap script from " + bootstrapScript + ": " + exception);
            });
        }
        catch (exc) {
            jq("#Intacct_StatusField").text("Error while initializing Intacct scripts. Please contact your administrator").addClass("intacct-error").show();
        }
    });  
</script>